// .txt

beginzonescript;

variables;

short im_hostile = 0;
short last_abil;
short counter = 0;
short set_ter1 = 0;
short gate_opened = 0;
short i;

body;

beginstate INIT_STATE;
	last_abil = get_current_tick();

	sf(61,21,0);
	if (gf(80,15) > 2) {
		erase_char(30001);
		erase_char(30002);
		erase_char(30003);
		erase_char(30004);
		erase_char(30006);
		set_terrain(0,34,13,0);
		}
	set_name(6100,"Raasa Elha");
	set_name(6101,"Raasa Rabila");
	set_name(6102,"Raasa Lawita");
	set_name(6103,"Raasa Suharum");
	if (gf(61,11) > 0)
		erase_char(6103);
	set_name(30002,"Warrior of the Ro");
	set_name(30003,"Warrior of the Ro");
	set_name(30004,"Warrior of the Ro");
	set_name(6133,"Proserpexa");
	if (gf(24,15) == 0)
		erase_char(6133);
	set_name(6166,"Purity");


//	set_attack_range(,);

//	add_ability(short which_char_or_group,short which_slot,short which_ability,0);

//	if (is_town_clear(ME))
//		clean_up_town();

	if (gf(80,15) < 3)
		sf(61,15,0);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((gf(61,11) > 0) && (gf(61,12) > 0) && (gf(61,13) > 0) && (gf(61,14) > 0) && (gf(61,15) == 0) && (gf(61,21) == 0)) {
		sf(61,21,1);
		erase_char(30001);
		activate_hidden_group(5);
		set_name(6125,"Raasa Suharum");
		set_name(6126,"Raasa Elha");
		set_name(6127,"Raasa Rabila");
		set_name(6128,"Raasa Lawita");
		}
		
	//if ((set_ter1 == 0) && (gf(0,0) > 0)) {
	//	set_ter1 = 1;
	//	set_terrain(,,,);
	//	}
		
	// start event and event stuff
	if ((gf(61,15) == 0) && (gf(80,15) < 3) && (on_which_layer() == 0) && (party_within_dist(34,12,5)))
		{
		sf(61,21,0);
		sf(61,15,1);
		
		talk_no_exit(130);
		}
	if ((gf(61,15) == 3) && (num_chars_in_group(10) == 0))	{
		sf(61,15,4);
		}
	if ((gf(61,15) == 6) && (num_chars_in_group(11)	== 0)){
		sf(61,15,7);
		}
	if ((gf(61,15) == 9) && (num_chars_in_group(12) == 0) && (num_chars_in_group(13) == 0)) {
		sf(61,15,10);
		}
	if ((gf(61,15) > 0) && (gf(80,15) < 3)) {
		i = random_group_member(0);
		if (dist_to_loc(i,34,12) > 7) {
			relocate_char(i,34,14,1);
			begin_talk_mode(19);
			}
		i = random_group_member(0);
		if (dist_to_loc(i,34,12) > 7) {
			relocate_char(i,34,14,1);
			begin_talk_mode(19);
			}
		i = random_group_member(0);
		if (dist_to_loc(i,34,12) > 7) {
			relocate_char(i,34,14,1);
			begin_talk_mode(19);
			}
		i = random_group_member(0);
		if (dist_to_loc(i,34,12) > 7) {
			relocate_char(i,34,14,1);
			begin_talk_mode(19);
			}
		}	
		
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6100,"I will give a lesson.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6100,"It is time.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6100,"I am the Wolf.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6100,"I wanted you to come.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6101,"I am Raasa now.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6101,"I am from the Kranas.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6101,"Much to decide.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6101,"War is here.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6101,"Elha lives.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6102,"The raiders are gone.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6102,"The rebels are near.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6102,"The rebels attack soon.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6102,"Final decisions.");
	if (get_ran(1,0,100) < 10)
		give_char_text_bubble(6102,"Raasa Elha demands war.");
	if (get_ran(1,0,100) < 20)
		give_char_text_bubble(6117 + get_ran(1,0,7),"Brrrr.");
	if (get_ran(1,0,100) < 20)
		give_char_text_bubble(6117 + get_ran(1,0,7),"Time for testing.");
	if (get_ran(1,0,100) < 20)
		give_char_text_bubble(6117 + get_ran(1,0,7),"Who will challenge?");
	if (get_ran(1,0,100) < 20)
		give_char_text_bubble(6117 + get_ran(1,0,7),"Haven has come.");


	//if (gf(,) < 2) {
	//	inc_flag(,,1);
	//	if (gf(,) == 2)
	//		begin_talk_mode();
	//	}

	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_town()) && (tick_difference(last_abil,get_current_tick()) > 2))) {
		last_abil = get_current_tick();
		
		if (gf(61,15) == 1)
			sf(61,15,2);
			else if (gf(61,15) == 2) {
				sf(61,15,3);
				talk_no_exit(140);
				}
			else if (gf(61,15) == 4)
				sf(61,15,5);
			else if (gf(61,15) == 5) {
				sf(61,15,6);
				talk_no_exit(150);
				}
			else if (gf(61,15) == 7)
				sf(61,15,8);
			else if (gf(61,15) == 8) {
				sf(61,15,9);
				erase_char(6126);
				talk_no_exit(160);
				}
			else if (gf(61,15) == 10) {
				sf(61,15,11);
				talk_no_exit(190);
				}
			
		}
break;

beginstate 10;

break;

beginstate 11;
break;

beginstate 12;
break;

beginstate 13;
break;

//	print_str("");
//	set_terrain_string_range(".",1);
//	set_terrain_string_range("The sign says - .",1);
